export interface PostsState {
  id: number;
  thumb_url: string;
  content: string;
  type: number;
  create_time: Date;
  update_time: Date;
  title: string;
  author: string;
}

export enum PostsActionType {
  RESET_STATE = '[user] reset state',
  SET_ID = 1,
  SET_THUMB_URL = '[user] set thumb_url',
  SET_CONTENT = '[user] set name',
  SET_TYPE = 1,
  SET_CREATE_TIME = ' set create time',
  SET_UPDATE_TIMR = 'set update tme',
  SET_TITLE = 'set title'
}

export interface RestStateAction {
  type: PostsActionType.RESET_STATE;
}
export interface SetIdAction {
  type: PostsActionType.SET_ID;
  payload: {id: number};
}

export interface SetThumbUrlAction {
  type: PostsActionType.SET_THUMB_URL;
  payload: {thumb_url: string};
}

export interface SetContentAction {
  type: PostsActionType.SET_CONTENT;
  payload: {content: string};
}

export interface SetTypeAction {
  type: PostsActionType.SET_TYPE;
  payload: {type: number};
}

export interface SetCreateTimeAction {
  type: PostsActionType.SET_CREATE_TIME;
  payload: {create_time: Date};
}

export interface SetUpdateTimeAction {
  type: PostsActionType.SET_UPDATE_TIMR;
  payload: {update_time: Date};
}

export interface SetTitleAction {
  type: PostsActionType.SET_TITLE;
  payload: {title: string};
}

export type UserAction =
  | RestStateAction
  | SetIdAction
  | SetThumbUrlAction
  | SetContentAction
  | SetTypeAction
  | SetCreateTimeAction
  | SetUpdateTimeAction
  | SetTitleAction;
